<template>
  <el-form :inline="true" :model="formInline" class="form-inline">
    <el-form-item label="用户姓名：">
      <el-input
        v-model="formInline.nickName"
        placeholder="--请输入--"
      ></el-input>
    </el-form-item>
    <el-form-item label="所属角色：">
    <el-select v-model="formInline.deviceType" class="m-2" placeholder="--请选择--" size="large">
    <el-option
      v-for="item in props.rowData"
      :key="item.name"
      :value="item.name"
    />
  </el-select>
    </el-form-item>
    <el-form-item class="btns">
      <el-button type="primary" @click="onSubmit">查询</el-button>
      <el-button type="success" class="m-left" @click="onClear">清空</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { defineProps, reactive, defineEmits } from 'vue'

const props = defineProps({
  rowData: {
    type: Object,
    default: () => {}
  }
})

const formInline = reactive({
  nickName: '',
  deviceType: '',
})

const emits = defineEmits(['onSearch', 'fou'])

const onSubmit = () => {
  emits('onSearch', formInline)
}
const onClear = () => {
  formInline.nickName = ''
  formInline.deviceType = ''
  emits('onSearch', formInline)
}
</script>

<style lang="scss" scoped>
.form-inline {
  width: 100%;
  position: relative;
  display: flex;
  column-gap: 20px;
  .btns {
    position: absolute;
    right: 0;
    top: 4px;
    .m-left {
      margin-left: 20px;
    }
  }
}
</style>
